<%@ include file="/common/taglibs.jsp"%>

<menu:useMenuDisplayer name="Velocity" config="navbarMenu.vm" permissions="rolesAdapter">
    <ul class="sidebar-menu">
        <c:if test="${empty pageContext.request.remoteUser}">
            <li class="active">
                <a href="<c:url value="/login"/>"><fmt:message key="login.title"/></a>
            </li>
        </c:if>
        <!--menu:displayMenu name="UserMenu"/-->

        <!--LoanRequest-START-->
        <%--<menu:displayMenu name="LoanRequestNewMenu"/>
        <menu:displayMenu name="LoanRequestAllMenu"/>
        <menu:displayMenu name="LoanRequest_draft"/>
        <menu:displayMenu name="LoanRequest_dealer_submit"/>

         --%>
        <security:authorize ifAnyGranted="ROLE_DEALER_USER">
            <li class="${pageContext.request.requestURI=='/loanRequestform'?'active':''}">
                <a href="<c:url value="/loanRequestform"/>"><i class="fa fa-plus"></i><span><fmt:message key="loanRequest.new"/></span></a>
            </li>
        </security:authorize>
        <security:authorize ifAnyGranted="ROLE_ADMIN,ROLE_DEALER_USER,ROLE_CC,ROLE_CA,ROLE_SCA,ROLE_Booking,ROLE_Insurance,ROLE_Bond_USER,ROLE_Bank_USER,ROLE_Bank_CREDIT">
            <li class="${pageContext.request.requestURI=='/loanRequests'?'active':''}">
                <a href="<c:url value="/loanRequests"/>"><i class="fa fa-database"></i><span><fmt:message key="loanRequestList.all"/></span></a>
            </li>
        </security:authorize>
        <security:authorize ifAnyGranted="ROLE_DEALER_USER">
            <li class="${pageContext.request.getParameter('phase')=='denied'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=denied"/>"><i class="fa fa-pencil"></i><span><fmt:message key="REQUEST_STATUS_denied"/></span></a>
            </li>
            <li class="${pageContext.request.getParameter('phase')=='cancelled'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=cancelled"/>"><i class="fa fa-pencil"></i><span><fmt:message key="REQUEST_STATUS_cancelled"/></span></a>
            </li>
            <li class="${pageContext.request.getParameter('phase')=='draft'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=draft"/>"><i class="fa fa-pencil"></i><span><fmt:message key="REQUEST_STATUS_draft"/></span></a>
            </li>
            <li class="${pageContext.request.getParameter('phase')=='dealer_submit'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=dealer_submit"/>"><i class="fa fa-bookmark"></i><span><fmt:message key="REQUEST_STATUS_dealer_submit"/></span></a>
            </li>
            <li class="${pageContext.request.getParameter('phase')=='dealer_apply_loan'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=dealer_apply_loan"/>"><i class="fa fa-cny"></i><span><fmt:message key="REQUEST_STATUS_dealer_apply_loan"/></span></a>
            </li>
            <li class="${pageContext.request.requestURI=='/attachmentSendList'?'active':''}">
                <a href="<c:url value="/materialSendList"/>"><i class="fa fa-cny"></i><span><fmt:message key="menu.material.send"/></span></a>
            </li>
        </security:authorize>
        <security:authorize ifAnyGranted="ROLE_Bank_CREDIT">
            <li class="${pageContext.request.getParameter('phase')=='bank_credit_audit'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=bank_credit_audit"/>"><i class="fa fa-compass"></i><span><fmt:message key="REQUEST_STATUS_bank_credit_audit"/></span></a>
            </li>
        </security:authorize>
        <security:authorize ifAnyGranted="ROLE_Bank_USER">
            <li class="${pageContext.request.getParameter('phase')=='bank_loan_audit'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=bank_loan_audit"/>"><i class="fa fa-bookmark"></i><span><fmt:message key="PHASE_bank_loan_audit"/></span></a>
            </li>
            <li class="${pageContext.request.getParameter('phase')=='bank_pending_loan'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=bank_pending_loan"/>"><i class="fa fa-cny"></i><span><fmt:message key="PHASE_bank_pending_loan"/></span></a>
            </li>

        </security:authorize>

        <%--<security:authorize ifAnyGranted="ROLE_Bank_RECEIVER">
            <li class="${pageContext.request.requestURI=='/attachmentReceiveList'?'active':''}">
                <a href="<c:url value="/materialReceiveList"/>"><i class="fa fa-cny"></i><span><fmt:message key="menu.material.receive"/></span></a>
            </li>
        </security:authorize>--%>

        <security:authorize ifAnyGranted="ROLE_M_RECEIVE">
            <li class="${pageContext.request.requestURI=='/attachmentReceiveList'?'active':''}">
                <a href="<c:url value="/materialReceiveList"/>"><i class="fa fa-cny"></i><span><fmt:message key="menu.material.receive"/></span></a>
            </li>
        </security:authorize>

        <security:authorize ifAnyGranted="ROLE_M_AUDIT">
            <li class="${pageContext.request.requestURI=='/attachmentReceiveList'?'active':''}">
                <a href="<c:url value="/materialAuditList"/>"><i class="fa fa-cny"></i><span><fmt:message key="menu.material.audit"/></span></a>
            </li>
        </security:authorize>

        <security:authorize ifAnyGranted="ROLE_M_PRINT">
            <li class="${pageContext.request.requestURI=='/attachmentReceiveList'?'active':''}">
                <a href="<c:url value="/materialPrintList"/>"><i class="fa fa-cny"></i><span><fmt:message key="menu.material.print"/></span></a>
            </li>
        </security:authorize>

        <security:authorize ifAnyGranted="ROLE_Bank_TELLER">
            <li class="${pageContext.request.requestURI=='/prepayments'?'active':''}">
                <a href="<c:url value="/prepayments"/>"><i class="fa fa-cny"></i><span><fmt:message key="menu.prepayment"/></span></a>
            </li>
            <li class="${pageContext.request.requestURI=='/loanedRequests'?'active':''}">
                <a href="<c:url value="/loanedRequests"/>"><i class="fa fa-cny"></i><span><fmt:message key="menu.loanedRequests"/></span></a>
            </li>
        </security:authorize>

        <security:authorize ifAnyGranted="ROLE_Bank_MANAGER">
            <li class="${pageContext.request.requestURI=='/pendingMoneyTransferRecords'?'active':''}">
                <a href="<c:url value="/pendingMoneyTransferRecords"/>"><i class="fa fa-cny"></i><span><fmt:message key="menu.pendingMoneyTransferRecords"/></span></a>
            </li>
            <li class="${pageContext.request.requestURI=='/transferredMoneyTransferRecords'?'active':''}">
                <a href="<c:url value="/transferredMoneyTransferRecords"/>"><i class="fa fa-cny"></i><span><fmt:message key="menu.transferredMoneyTransferRecords"/></span></a>
            </li>
        </security:authorize>

        <security:authorize ifAnyGranted="ROLE_Bank_ADMIN">
            <li class="${pageContext.request.requestURI=='/bankusers'?'active':''}">
                <a href="<c:url value="/bankusers"/>"><i class="fa fa-user"></i><span><fmt:message key="menu.admin.users"/></span></a>
            </li>
        </security:authorize>

        <security:authorize ifAnyGranted="ROLE_CC">
            <li class="${pageContext.request.getParameter('phase')=='cc_audit'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=cc_audit"/>"><i class="fa fa-magic"></i><span><fmt:message key="REQUEST_STATUS_request_audit"/></span></a>
            </li>
        </security:authorize>

        <security:authorize ifAnyGranted="ROLE_CA">
            <li class="${pageContext.request.getParameter('phase')=='ca_audit'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=ca_audit"/>"><i class="fa fa-magic"></i><span><fmt:message key="REQUEST_STATUS_request_audit"/></span></a>
            </li>
        </security:authorize>

        <security:authorize ifAnyGranted="ROLE_SCA">
            <li class="${pageContext.request.getParameter('phase')=='sca_audit'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=sca_audit"/>"><i class="fa fa-magic"></i><span><fmt:message key="REQUEST_STATUS_request_audit"/></span></a>
            </li>
        </security:authorize>
        <security:authorize ifAnyGranted="ROLE_Booking">
            <li class="${pageContext.request.getParameter('phase')=='booking_audit'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=booking_audit"/>"><i class="fa fa-cny"></i><span><fmt:message key="REQUEST_STATUS_loan_audit"/></span></a>
            </li>
        </security:authorize>
        <security:authorize ifAnyGranted="ROLE_Bond_USER">
            <c:if test="${not loggedUser.bondCompany.autoAudit}">
                <li class="${pageContext.request.getParameter('phase')=='bond_request_audit'?'active':''}">
                    <a href="<c:url value="/myloanrequests?phase=bond_request_audit"/>"><i class="fa fa-magic"></i><span><fmt:message key="REQUEST_STATUS_request_audit"/></span></a>
                </li>
                <li class="${pageContext.request.getParameter('phase')=='bond_loan_audit'?'active':''}">
                    <a href="<c:url value="/myloanrequests?phase=bond_loan_audit"/>"><i class="fa fa-cny"></i><span><fmt:message key="REQUEST_STATUS_loan_audit"/></span></a>
                </li>
                <%--<menu:displayMenu name="LoanRequest_bond_request_audit"/>--%>
                <%--<menu:displayMenu name="LoanRequest_bond_loan_audit"/>--%>
            </c:if>
        </security:authorize>

        <security:authorize ifAnyGranted="ROLE_Insurance">
            <c:if test="${loggedUser.isMaster()}">
            <li class="${pageContext.request.getParameter('phase')=='insurance_confirm_cover'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=insurance_confirm_cover"/>"><i class="fa fa-compass"></i><span><fmt:message key="PHASE_insurance_confirm_cover"/></span></a>
            </li>
            </c:if>
            <c:if test="${loggedUser.isSlave()}">
            <li class="${pageContext.request.getParameter('phase')=='qualification_audit'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=qualification_audit"/>"><i class="fa fa-compass"></i><span><fmt:message key="PHASE_qualification_audit"/></span></a>
            </li>
            </c:if>
            <%--<li class="${pageContext.request.getParameter('phase')=='insurance_loan_audit'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=insurance_loan_audit"/>"><i class="fa fa-cny"></i><span><fmt:message key="PHASE_insurance_loan_audit"/></span></a>
            </li>--%>
            <%--<li class="${pageContext.request.getParameter('phase')=='insurance_upload_cover'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=insurance_upload_cover"/>"><i class="fa fa-bookmark"></i><span><fmt:message key="PHASE_insurance_upload_cover"/></span></a>
            </li>--%>
            <c:if test="${loggedUser.isMaster()}">
            <li class="${pageContext.request.getParameter('phase')=='insurance_confirm_policy'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=insurance_confirm_policy"/>"><i class="fa fa-compass"></i><span><fmt:message key="PHASE_insurance_confirm_policy"/></span></a>
            </li>
            </c:if>
            <c:if test="${loggedUser.isMaster()}">
            <li class="${pageContext.request.getParameter('phase')=='insurance_upload_policy'?'active':''}">
                <a href="<c:url value="/myloanrequests?phase=insurance_upload_policy"/>"><i class="fa fa-send-o"></i><span><fmt:message key="PHASE_insurance_upload_policy"/></span></a>
            </li>
            </c:if>
        </security:authorize>

        <%--<menu:displayMenu name="LoanRequest_bank_credit_audit"/>--%>



        <%--<menu:displayMenu name="LoanRequest_cc_audit"/>--%>
        <%--<menu:displayMenu name="LoanRequest_ca_audit"/>--%>
        <%--<menu:displayMenu name="LoanRequest_sca_audit"/>--%>
        <%--<menu:displayMenu name="LoanRequest_qualification_audit"/>--%>
        <%--<menu:displayMenu name="LoanRequest_dealer_apply_loan"/>--%>
        <%--<menu:displayMenu name="LoanRequest_booking_audit"/>--%>
        <%--<menu:displayMenu name="LoanRequest_insurance_loan_audit"/>--%>
        <%--<menu:displayMenu name="LoanRequest_insurance_upload_cover"/>--%>
        <%--<menu:displayMenu name="LoanRequest_bank_loan_audit"/>--%>
        <%--<menu:displayMenu name="LoanRequest_bank_pending_loan"/>--%>
        <%--<menu:displayMenu name="LoanRequest_insurance_confirm_policy"/>--%>

        <%--<security:authorize ifNotGranted="ROLE_Booking">--%>
            <%--<c:if test="${loggedUser.bondCompany.masterProvider}">--%>
        <%--<menu:displayMenu name="LoanRequest_insurance_upload_policy"/>--%>
            <%--</c:if>--%>
        <%--</security:authorize>--%>

        <security:authorize ifAnyGranted="ROLE_Insurance, ROLE_Bond_USER">
            <li class="${pageContext.request.requestURI=='/policyRequests'?'active':''}">
                <a href="<c:url value="/policyRequests"/>"><i class="fa fa-info"></i><span><fmt:message key="MENU_policy"/></span></a>
            </li>
        </security:authorize>
        <%--<menu:displayMenu name="LoanRequest_policy_list"/>--%>


        <c:if test="${materialRequests.size()>0}">
            <li class="${pageContext.request.requestURI=='/materialRequests'?'active':''}">
                <a href="<c:url value="/materialRequests"/>"><i class="fa fa-dashboard"></i><span><fmt:message key="FEEDBACK_TYPE_MaterialType"/><small class="label pull-right bg-yellow">${materialRequests.size()}</small></span></a>
            </li>
        </c:if>
        <!--LoanRequest-END-->

        <!--Admin-START-->
        <security:authorize ifAnyGranted="ROLE_ADMIN">
            <li class="${pageContext.request.requestURI=='/banks'?'active':''}">
                <a href="<c:url value="/banks"/>"><i class="fa fa-bank"></i><span><fmt:message key="bankList.title"/></span></a>
            </li>
            <li class="${pageContext.request.requestURI=='/loanProducts'?'active':''}">
                <a href="<c:url value="/loanProducts"/>"><i class="fa fa-calculator"></i><span><fmt:message key="loanProductList.title"/></span></a>
            </li>
            <li class="${pageContext.request.requestURI=='/bondCompanies'?'active':''}">
                <a href="<c:url value="/bondCompanies"/>"><i class="fa fa-briefcase"></i><span><fmt:message key="bondCompanyList.title"/></span></a>
            </li>
            <li class="${pageContext.request.requestURI=='/dealers'?'active':''}">
                <a href="<c:url value="/dealers"/>"><i class="fa fa-automobile"></i><span><fmt:message key="dealerList.title"/></span></a>
            </li>
            <li class="${pageContext.request.requestURI=='/admin/users'?'active':''}">
                <a href="<c:url value="/admin/users"/>"><i class="fa fa-user"></i><span><fmt:message key="menu.userList"/></span></a>
            </li>
            <li class="${pageContext.request.requestURI=='/notices'?'active':''}">
                <a href="<c:url value="/notices"/>"><i class="fa fa-tasks"></i><span><fmt:message key="noticeList.title"/></span></a>
            </li>

        </security:authorize>
        <%--<menu:displayMenu name="BankMenu"/>--%>
        <%--<menu:displayMenu name="LoanProductMenu"/>--%>
        <%--<menu:displayMenu name="BondCompanyMenu"/>--%>
        <%--<menu:displayMenu name="DealerMenu"/>--%>
        <%--<menu:displayMenu name="DealerUsersMenu"/>--%>
        <!--Dealer-END-->
        <%--<menu:displayMenu name="BankUsersMenu"/>--%>

        <%--<menu:displayMenu name="UserListMenu"/>--%>

        <!--Notice-START-->
        <%--<menu:displayMenu name="NoticeMenu"/>--%>
        <!--Notice-END-->

        <menu:displayMenu name="AdminMenu"/>

        <%--<menu:displayMenu name="DocumentMenu"/>--%>

        <security:authorize ifAnyGranted="ROLE_CC,ROLE_DEALER_USER,ROLE_CA,ROLE_SCA,ROLE_Booking,ROLE_Insurance">
            <li class="${pageContext.request.requestURI=='/document'?'active':''}">
                <a href="<c:url value="/document"/>"><i class="fa fa-book"></i><span><fmt:message key="document.title"/></span></a>
            </li>
        </security:authorize>

    </ul>
</menu:useMenuDisplayer>
